package com.dayuanit.dy17.mix.aop.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 日志的切面
 */
@Component
@Aspect
public class LoggerAspect {

    @Pointcut("execution(* com.dayuanit.dy17.mix.aop.service.impl.*.*(..))")
    public void pointCut() {

    }

    @Before("pointCut()")
    public void doBefore(JoinPoint joinPoint) {
        System.out.println("logger before");
        System.out.println("logger aspect before  targetName=" + joinPoint.getTarget().getClass().getName());
        Object[] args = joinPoint.getArgs();
        for (Object param : args) {
            System.out.println("logger >>" + param);
        }
    }
}
